<!DOCTYPE html>
<html>
<head>
    {include file='public/meta'/}
    <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrapSwitch.css">

    <link rel="stylesheet" href="__STATIC_URL__/static/css/setcard.css"/>

    <script src="__STATIC_URL__/static/js/setcardgift.js" type="text/javascript" charset="utf-8"></script>
    <script src="__STATIC_URL__/static/js/giftcreat4.js?v=8"></script>
    <style>
        .panel-footer{
            text-align:center;
        }
    </style>
</head>
<body id="body">
{include file='public/header'/}
<!------------------导航-------------------------->
<section>
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <!--路径导航-->
        <ol class="breadcrumb">
            <li>当前位置是&nbsp;:</li>
            <li>
                <a href="{:url('cardgifts/cardgiftlist')}">礼品卡</a>
            </li>
            <li class="active" style="color: #02b87f;">创建礼品卡</li>
        </ol>
        <!--创建会员卡主要内容-->
        <div class="card-content clearfix">
            <div class="pull-left card-left" style="min-height: 582px;">

            <div class="cardL-body">
                    <div class="cardL-title"
                         style="background: #000 url(/assets/merchant/image/APPtop.png) no-repeat center top;"></div>
                    <div style="padding: 15px;">
                        <div class="card"
                             style="background-image: url(__STATIC_URL__/static/images/cover1.png);background-position: left top;background-repeat: repeat;background-size: cover;">
                            <div class="cardL-top">
                                <div class="cardL-logo-wrap pull-left">
                                    <div style="background-size: cover;background-image:url({$moinfo['img_wx']});background-position:left top;"
                                         class="cardL-logo logopic"></div>
                                </div>
                                <div class="pull-left">
                                    <div class="cardL-name brand_name">商户名称</div>
                                    <div class="cardL-name brand_title">礼品卡名称</div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!--<div class="cardL-type">-->
                    <!--<div class="card_custom_field left-jifen">-->
                        <!--<span class="r-title">积分</span>-->
                        <!--<span class="r-describe" style="color: rgb(53, 164, 222);">0</span>-->
                    <!--</div>-->

                <!--</div>-->
                <div class="quick_pay show ng-scope member-card-editable-container  left-tabs" id="pay-weixin">
                    <a href="javascript:;" class="r-btn ng-binding centerbt centerbt-bt" style="color: rgb(53, 164, 222); border-color: rgb(53, 164, 222); ">
                        未填写
                    </a>
                    <div style="font-size: 12px;margin-top: 4px;color:#7d7d7d;"
                         class="centerfbt ng-binding ng-scope center-title centerfbt-bt">
                    </div>
                </div>
                <div class="r-cell s-first" id="card-self-tab">
                    <ul>

                        <!--<li class="member-card-editable-container left-tabs recharge"-->
                            <!--onclick="tabsigleshow('settings','recharge')">-->
                            <!--<span class="ng-binding self-0-bt cell1-bt cell1">自定义入口</span>-->
                            <!--<span class="r-tip  self-0-lfbt tit1-bt tit1">未使用</span>-->
                        <!--</li>-->
                        <!--<li class="member-card-editable-container left-tabs integral"-->
                            <!--onclick="tabsigleshow('settings','integral')">-->
                            <!--<span class="ng-binding self-1-bt cell2-bt cell2">自定义入口1</span>-->
                            <!--<span class="r-tip  self-1-lfbt tit2-bt tit2">未使用</span>-->
                        <!--</li>-->
                        <!--<li class="member-card-editable-container left-tabs marketing"-->
                            <!--onclick="tabsigleshow('settings','marketing')">-->
                            <!--<span class="ng-binding self-2-bt cell3-bt cell3">营销入口</span>-->
                            <!--<span class="r-tip ng-binding self-2-lfbt tit3-bt tit3">未使用</span>-->
                        <!--</li>-->
                        <li class="member-card-editable-container left-tabs recommend"
                            onclick="tabsigleshow('settings','recommend')">
                            <span class="ng-binding self-3-bt cell4-bt cell4">营销入口</span>
                            <span class="r-tip ng-binding self-3-lfbt tit4-bt tit4">未使用</span>
                        </li>
                        <li class="member-card-editable-container memberDetail carddetail left-tabs" onclick="tabsigleshow('carddetail','memberDetail')">
                            <span>礼品卡详情</span>
                        </li>
                        <li class="member-card-editable-container applyMall carddetail left-tabs" onclick="tabsigleshow('carddetail','applyMall')"><span>适用门店</span></li>
                        <li><span>公众号</span></li>
                    </ul>
                </div>
            </div>
            <div class="cardR-right">
                <div class="alert alert-success" role="alert">
                    <strong>订单提交地址（填入中心按钮或自定义/营销入口）：{$url['platurl']}/mobile.php?s=/cardgifts/referorder</strong>
                </div>
                <div style="width: 100%;">
                    <!-- TAB导航 -->
                    <ul class="nav nav-tabs" role="tablist" id="myTabs">
                        <li role="presentation" class="active" id="homes">
                            <a href="#home" aria-controls="home" role="tab" data-toggle="tab">基本信息</a>
                        </li>
                        <li role="presentation" id="messagess">
                            <a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">中心按钮</a>
                        </li>
                        <li role="presentation" id="settingss">
                            <a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">自定义/营销入口</a>
                        </li>

                        <li role="presentation" id="carddetails">
                            <a href="#carddetail" aria-controls="carddetail" role="tab" data-toggle="tab">礼品卡详情</a>
                        </li>
                    </ul>
                    <!-- Tab 内容 -->

                    <div class="panel panel-default" style="margin-top: 15px;">

                        <form class="form-horizontal" action="" method="post" id="creatcards">
                            <div class="tab-content">
                                <!--基本信息-->
                                <div role="tabpanel" class="tab-pane active" id="home">
                                    <div class="panel-heading">基本信息</div>
                                    <div class="panel-body">
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">卡券封面：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <select class="form-control" id="cover">
                                                    <option value="1">图片</option>
                                                    <option value="2">颜色</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label"></label>
                                            <div class="col-sm-10">
                                                <div class="show cover">
                                                    <div class="r-desc ng-scope">请参照
                                                        <a style="color: #2db7f5;display: inline-block;font-size: 14px;"
                                                           href="https://mp.weixin.qq.com/cgi-bin/readtemplate?t=cardticket/card_cover_tmpl&amp;type=info&amp;lang=zh_CN"
                                                           title="" target="_blank">图片规范</a> 上传   建议1000*600像素 格式为.jpg
                                                    </div>
                                                    <div class="ng-scope" style="position: relative;">
                                                        <span class="btn btn-default">上传礼品卡图片</span><span class="mgl15 text-danger">若须更换背景图，请选择上传背景图   </span>
                                                        <input type="file" id="card" value=""onchange="upload('card', 'file')"/>
                                                        <input type="hidden" name="background_pic_url" id="card-upload"value="">
                                                    </div>
                                                </div>
                                                <div class="cover hide" id="colors">
                                                    <input type="hidden" name="base[color]" value="#63b359">
                                                    <ul class="color-list clearfix">
                                                        <li class="selected" style="background-color:#63b359;"
                                                            data-color="#63b359"></li>
                                                        <li style="background-color:#2c9f67;" data-color="#2c9f67"></li>
                                                        <li style="background-color:#509fc9;" data-color="#509fc9"></li>
                                                        <li style="background-color:#5885cf;" data-color="#5885cf"></li>
                                                        <li style="background-color:#9062c0;" data-color="#9062c0"></li>
                                                        <li style="background-color:#d09a45;" data-color="#d09a45"></li>
                                                        <li style="background-color:#e4b138;" data-color="#e4b138"></li>
                                                        <li style="background-color:#ee903c;" data-color="#ee903c"></li>
                                                        <li style="background-color:#f08500;" data-color="#f08500"></li>
                                                        <li style="background-color:#a9d92d;" data-color="#a9d92d"></li>
                                                        <li style="background-color:#dd6549;" data-color="#dd6549"></li>
                                                        <li style="background-color:#cc463d;" data-color="#cc463d"></li>
                                                        <li style="background-color:#cf3e36;" data-color="#cf3e36"></li>
                                                        <li style="background-color:#5E6671" data-color="#5E6671"></li>
                                                    </ul>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">门店：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-9 col-xs-12">
                                                <select name="mid" class="form-control" id="mid"  onchange="subid(this);">

                                                    {volist name="mach" id="mach"}
                                                    <option value="{$mach['id']}" data-sub="{$mach['sub_mch_id']}">{$mach['merchant']}</option>
                                                    {/volist}
                                                </select>
                                                <div class="text-danger">只显示已授权微信公众号的门店</div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">商户名称：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                              
                                                <input type="text" name="base[brand_name]" id="brand_name"
                                                       class="form-control" oninput="binding('brand_name')" placeholder="可输入12个汉字" onchange="tex('brand_name','titletext','12');"/>
                                                <div class="help-block" id="titletext"></div>
                                                <div class="r-desc ng-binding ng-scope">建议商户名或服务内容，如**礼品卡 字数上限为12个字。</div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">礼品卡标题：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <input type="text" name="base[title]" class="form-control"
                                                       id="brand_title" oninput="binding('brand_title')" placeholder="可输入9个汉字" onchange="tex('brand_title','brandtext','9');"/>
                                                <div class="help-block" id="brandtext"></div>
                                                <div class="r-desc ng-binding ng-scope">建议礼品卡标题包含商户名或服务内容，如**礼品卡 字数上限为9个字。</div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">LOGO：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <div class="ng-scope" style="position: relative;">
                                                    <span class="btn btn-default">上传LOGO</span>
                                                    <input type="file" id="logopic" value=""  onchange="upload('logopic', 'file')"/>
                                                    <input type="hidden" name="base[logo_url]" id="logopic-upload" value="{$moinfo['img_wx']}" >
                                                </div>
                                                <img {if condition="$moinfo['img_wx'] eq ''"}src='__STATIC_URL__/static/images/LOGO.png'{else}src='{$moinfo['img_wx']}'{/if} alt="" class="logopic-img" style="margin-top: 10px;width: 100px;height: 100px;border: none;display: block;"/>
                                                <div class="r-desc ng-binding ng-scope">建议300*300像素 格式为.jpg</div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label ng-binding">code展示类型：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <select name="base[code_type]"
                                                        class="selectpicker form-control ng-valid ng-scope ng-not-empty ng-dirty ng-valid-parse ng-touched"
                                                        style="">
                                                    <option label="文本" value="CODE_TYPE_TEXT">文本</option>
                                                    <option label="一维码" value="CODE_TYPE_BARCODE">一维码</option>
                                                    <option label="二维码" value="CODE_TYPE_QRCODE" selected="selected">
                                                        二维码
                                                    </option>
                                                    <option label="仅显示二维码" value="CODE_TYPE_ONLY_QRCODE">仅显示二维码</option>
                                                    <option label="仅显示一维码" value="CODE_TYPE_ONLY_BARCODE">仅显示一维码
                                                    </option>
                                                    <option label="不显示任何码型" value="CODE_TYPE_NONE">不显示任何码型</option>
                                                </select>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">创建库存数量：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <input type="text" name="base[sku][quantity]" class="form-control" id="kucun"/>
                                                <input type="hidden" name="activate" value="0">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">礼品卡价格：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <input type="text" name="base[price]" class="form-control"
                                                       id="price"/>
                                                <div class="help-block" id="pricetext"></div>
                                                <div class="r-desc ng-binding ng-scope"></div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">最大可赠送次数：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <input type="text" name="base[max_give_friend_times]" class="form-control"
                                                       id="max_give_friend_times" value="1"/>
                                                <div class="help-block" id="max_give_friend_timestext"></div>
                                                <div class="r-desc ng-binding ng-scope"></div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">期限类型：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-3 col-xs-6 coupon-color">
                                                <select class="form-control" name="base[date_info][type]"  id="date_info">
                                                    <option value="DATE_TYPE_FIX_TIME_RANGE">自定义有效时间</option>
                                                    <option value="DATE_TYPE_FIX_TERM" id="dis">领取有效时间</option>
                                                    <option value="DATE_TYPE_PERMANENT" id="">永久有效</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group cover1">
                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">选择时间：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <input type="text" name="base[date_info][times]" class="form-control" value="" placeholder="请选择有效时间" readonly="readonly" id="starttime">
                                                <div class="r-message text-danger"></div>
                                            </div>
                                        </div>
                                        <div class="form-group cover2 hide">
                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">有效天数：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-3 col-xs-6 coupon-color">
                                                <input type="text" class="form-control pull-left"   name='base[date_info][fixed_term]' style="width:80%;"  placeholder="有效天数" id="fixed_term">
                                                <span class="pull-left" style="padding-top:4px">天</span>
                                            </div>

                                        </div>

                                        <div class="panel-footer">
                                            <a  id="shownext1" data-id="messages" class="btn btn-success">下一步</a>

                                        </div>


                                        <input name="supply_bonus" value="0" type="hidden">
                                        <input name="supply_balance" value="0" type="hidden">
                                    </div>
                                </div>

                                <div role="tabpanel" class="tab-pane" id="messages">
                                    <div class="panel-body">
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label ng-binding">中心按钮：</label>
                                            <div class="col-sm-10">
													<span class="radio pull-left" style="margin-right: 15px;">
														<input name="base[is_center]" checked="checked" value="1" type="radio" style="margin-left: 0;">
														<label class="ng-binding">显示</label>
													</span>
                                                <span class="radio pull-left">
														<input name="base[is_center]" type="radio" value="2" style="margin-left: 0;">
														<label class="ng-binding">不显示</label>
													</span>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label ng-binding">跳转类型：</label>
                                            <div class="col-sm-10">
                                                <select name="is_center_url_type" class="form-control " style="" id="tzs" onChange="tz(this,'swithtypexcx','view','xcxurl','text');">
                                                    <option  value="wxurl">跳转网页</option>
                                                    <option  value="wxxcx">跳转小程序</option>
                                                </select>
                                            </div>
                                        </div>
                                        <!--<div class="form-group">-->
                                            <!--<label class="col-sm-2 control-label ng-binding">按钮类型：</label>-->
                                            <!--<div class="col-sm-10">-->

                                                <!--<input type="text" value="9" class="form-control"  placeholder="请输入标题" id="centerbt-bt" style="margin-top: 10px;" name="base[center]" >-->
                                                <!--<div class="help-block" id="centext"></div>-->
                                            <!--</div>-->
                                        <!--</div>-->
                                        <div id="view">
                                        <div class="form-group" >
                                            <label class="col-sm-2 control-label ng-binding">标题：</label>
                                            <div class="col-sm-10">
                                                <input type="text" class="form-control swithtype swithtype-bt"  name="base[center_title]" id="centerbt" value="" placeholder=""  oninput="showtitl('centerbt',this);" onchange="tex('centerbt','centext','5');"/>

                                                <div class="centext"></div>
                                                <div class="r-desc ng-binding ng-scope">字段长度限制为5个汉字。</div>

                                            </div>
                                        </div>
                                        <div class="form-group" id="sub" style="display:block;">
                                            <label class="col-sm-2 control-label ng-binding">副标题：</label>
                                            <div class="col-sm-10">
                                                <input type="text" class="form-control swithtype swithtype-fbt" name="base[center_sub_title]" id="centerfbt" value="" placeholder="" oninput="showtitl('centerfbt',this);" onchange="text('centerfbt','','16');" />
                                                <div class="r-desc ng-binding ng-scope">字段长度限制为16个字符，中文2个字符，数字，字母1个字符。</div>

                                            </div>
                                        </div>
                                        </div>
                                        <div class="form-group" id="swithtypexcx" style="display:none">

                                            <label class="col-sm-2 control-label ng-binding">小程序原始ID：</label>
                                            <div class="col-sm-10">
                                                <input type="text"  value="" name="base[center_app_brand_user_name]" class="form-control" placeholder="请输入小程序原始ID"  id="cxcxapptext" >
                                                <div class="help-block" id=""></div>

                                            </div>

                                            <label class="col-sm-2 control-label ng-binding">小程序路径：</label>
                                            <div class="col-sm-10">
                                                <input type="text"  value="" class="form-control" name="base[center_app_brand_pass]" placeholder="请输入小程序路径" id="cnametext"  >
                                                <div class="help-block" id="">例：pages/index/index</div>
                                            </div>
                                        </div>
                                        <div class="form-group" id="urls">
                                            <label class="col-sm-2 control-label ng-binding" id="xcxurl">链接：</label>
                                            <div class="col-sm-10">
                                                <input type="text" class="form-control swithtype swithtype-url"  name="base[center_url]" id="center_url" value="" placeholder=""/>
                                                <div class="help-block" id="text"></div>

                                            </div>
                                        </div>


                                        <div class="panel-footer" style="margin-top:80px;">
                                            <a onClick="shownexts2('home')"  class="btn btn-success">上一步</a>

                                            <a  id="shownext2" data-id="settings" class="btn btn-success">下一步</a>
                                            <!--<button type="button"  id="btn1" class="btn btn-success">下一步</button>-->
                                        </div>
                                    </div>
                                </div>
                                <div role="tabpanel" class="tab-pane" id="settings">
                                    <div class="panel-body">

                                        <div class="panel panel-default" id="recommend">
                                            <div class="panel-heading">营销入口
                                                <div class="pull-right">
                                                    <input type="hidden" name="base[is_custom]" id="self-ipt-3" value="2">
                                                    <a class="btn-link ng-scope" href="javascript:;" data-type="3"
                                                       data-name="自定义入口1">已关闭</a>
                                                </div>
                                            </div>
                                            <div class="panel-body" style="padding:30px;">
                                                <div class="form-group">
                                                    <label class="font400">跳转类型：</label>
                                                    <div class="col-sm-12">
                                                        <select name="is_custom_url_type" class="form-control " id="is_custom_url" style=""  onChange="tz(this,'self-3xcx','views','xcxurls','texts');">
                                                            <option  value="wxurl">跳转网页</option>
                                                            <option  value="wxxcx">跳转小程序</option>
                                                        </select>
                                                    </div>
                                                </div>
                                                <div id="views">
                                                <div class="form-group">
                                                    <label class="font400">标题：</label>
                                                    <input type="text" value="" class="form-control" readonly="readonly" placeholder="请输入标题" id="cell4" style="margin-top: 10px;" name="base[custom_url_name]"  oninput="showinput(this.id,this);" onchange="tex('cell4','cell4text','5');">

                                                    <div class="r-desc ng-binding ng-scope">字段长度限制为5，请填写1-5个汉字</div>

                                                    <div class="help-block" id="cell4text"></div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="font400">副标题：</label>
                                                    <input type="text" name="base[custom_url_sub_title]" readonly="readonly" class="form-control self-3-fbt" id="tit4"  placeholder="请输入副标题" oninput="showtitl(this.id,this);" onchange="text('tit4','tit4text','12');">
                                                    <div class="help-block" id="tit4text"></div>
                                                    <div class="r-desc ng-binding ng-scope">字段长度限制为12个字符，中文2个字符，数字，字母1个字符。</div>

                                                </div>
                                                </div>
                                                <div class="form-group " id="self-3xcx" style="display:none">



                                                    <label class="font400">小程序原始ID：</label>

                                                    <input type="text"  value="" name="base[custom_app_brand_user_name]" class="form-control" placeholder="请输入小程序原始ID"  id="custom_app" >
                                                    <div class="help-block" id=""></div>



                                                    <label class="font400">小程序路径：</label>

                                                    <input type="text"  value="" class="form-control" name="base[custom_app_brand_pass]" placeholder="请输入小程序路径" id="app_brand"  >
                                                    <div class="help-block" id=""></div>

                                                </div>
                                                <div class="form-group">
                                                    <label class="font400" id="xcxurls">链接：</label>
                                                    <input type="text" name="base[custom_url]" readonly="readonly" class="form-control self-3-url"  placeholder="" id="self_url">
                                                    <div class="help-block" id="texts"></div>

                                                </div>

                                                <div class="panel-footer">
                                                    <a onClick="shownexts2('messages')"  class="btn btn-success">上一步</a>

                                                    <a  id="shownext3" data-id="carddetail"  class="btn btn-success">下一步</a>

                                                    <!--<button type="button"  id="btn1" class="btn btn-success">下一步</button>-->
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div role="tabpanel" class="tab-pane" id="carddetail">
                                    <div class="panel-body">
                                        <div class="panel panel-default" id="applyMall">
                                            <div class="panel-heading">适用门店</div>
                                            <div class="form-group">
                                                <label class="col-sm-2 control-label">适用门店：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                <div class="col-sm-10">
                                                    <div>
                                                        <span class="radio" style="margin-right: 15px;">
                                                            <input name="base[is_locations]" value="1" type="radio" checked style="margin-left: 0;">
                                                            <label class="ng-binding">全部门店（只有选择全部门店，APP礼品卡才会显示<span style="color: #00aff0;">适用门店</span>项）</label>
                                                        </span>
                                                    </div>
                                                    <!--<div>-->
                                                        <!--<span class="radio" style="margin-right: 15px;">-->
                                                            <!--<input name="base[is_locations]" value="2" type="radio" style="margin-left: 0;">-->
                                                            <!--<label class="ng-binding">指定门店</label>-->
                                                            <!--<div style="padding-left: 20px;" class="hide" id="zdmd">-->
                                                                <!--<input type="hidden" name="base[location_id_list]" id="location_id_list">-->
                                                                <!--<a href="javascript:;" data-toggle="modal" data-target="#myModal" style="color: #459AE9;font-size: 14px;">添加适用门店</a>-->
                                                            <!--</div>-->
                                                        <!--</span>-->
                                                    <!--</div>-->
                                                    <!--<div>-->
                                                        <!--<span class="radio" style="margin-right: 15px;">-->
                                                            <!--<input name="base[is_locations]" value="3" type="radio" style="margin-left: 0;">-->
                                                            <!--<label class="ng-binding">无指定门店</label>-->
                                                            <!--&lt;!&ndash;<div style="padding-left: 20px;overflow: hidden;" class="hide" id="wzdmd">&ndash;&gt;-->
                                                            <!--&lt;!&ndash;<span class="radio pull-left" style="margin-right: 15px;">&ndash;&gt;-->
                                                            <!--&lt;!&ndash;<input name="wzdtype" value="1" type="radio" checked style="margin-left: 0;">&ndash;&gt;-->
                                                            <!--&lt;!&ndash;<label class="ng-binding">网上经营，无须到店消费</label>&ndash;&gt;-->
                                                            <!--&lt;!&ndash;</span>&ndash;&gt;-->
                                                            <!--&lt;!&ndash;<span class="radio pull-left" style="margin-right: 15px;">&ndash;&gt;-->
                                                            <!--&lt;!&ndash;<input name="wzdtype" value="2" type="radio" style="margin-left: 0;">&ndash;&gt;-->
                                                            <!--&lt;!&ndash;<label class="ng-binding">其他原因</label>&ndash;&gt;-->
                                                            <!--&lt;!&ndash;</span>&ndash;&gt;-->
                                                            <!--&lt;!&ndash;</div>&ndash;&gt;-->
                                                        <!--</span>-->
                                                        <!--&lt;!&ndash;<div class="qtyy hide" style="margin-top: 8px;">&ndash;&gt;-->
                                                        <!--&lt;!&ndash;<textarea name="qtyy"  id="qtyy" class="form-control" cols="30" rows="10" style="resize: none;" placeholder="请认真填写原因"></textarea>&ndash;&gt;-->
                                                        <!--&lt;!&ndash;</div>&ndash;&gt;-->
                                                    <!--</div>-->
                                                </div>
                                            </div>
                                        </div>

                                        <div class="panel panel-default" id="memberDetail">
                                            <div class="panel-heading">礼品卡详情</div>
                                            <div class="panel-body">
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">特权说明：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                    <div class="col-sm-10">
                                                        <textarea name="prerogative" id="prerogative" rows="4" cols="" class="form-control" placeholder="例如：用卡可享受8.8折扣" style="resize: none;" ></textarea>
                                                    </div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">使用说明：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                    <div class="col-sm-10">
                                                        <textarea name="base[description]" id="description" rows="4" class="form-control"
                                                                  style="resize: none;"  placeholder="请认真填写" ></textarea>
                                                    </div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">电话：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                    <div class="col-sm-10">
                                                        <input type="text" class="form-control" id="service_phone" name="base[service_phone]" placeholder="请认真填写" value=""/>
                                                    </div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="col-sm-2 control-label">使用提醒：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                    <div class="col-sm-10">
                                                        <input name="base[notice]" class="form-control" maxlength="16" id="notice" style=""  placeholder="请认真填写" onchange="tex('notice','noticetext','16');">
                                                        <div class="help-block" id="noticetext"></div>
                                                        <div class="r-desc ng-binding ng-scope">建议引导用户到店出示礼品卡，由店员完成核销操作。(请保持16个汉字之内)</div>
                                                    </div>
                                                </div>
                                                <div class="panel-footer">
                                                    <a onClick="shownexts2('settings')"  class="btn btn-success">上一步</a>

                                                    <button type="submit"   class="btn btn-success">保存</button>
                                                </div>
                                                <!--<div class="form-group">-->
                                                <!--<label class="col-sm-2 control-label">图文介绍(选填)：</label>-->
                                                <!--<div class="col-sm-10">-->
                                                <!--<div class="r-desc ng-scope">图片建议尺寸：900像素 * 500像素，大小不超过2M。<br>至少上传1组图文，最多输入5000字-->
                                                <!--</div>-->
                                                <!--<div class="member-card text-image-list ">-->
                                                <!--<div class="text-image-list-add">-->
                                                <!--<span class="icon_article_add"><a-->
                                                <!--class="icon42_common add_gray">添加图文</a></span>-->
                                                <!--</div>-->
                                                <!--</div>-->
                                                <!--</div>-->
                                                <!--</div>-->
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </form>

                    </div>
                </div>
            </div>
        </div>

        {include file='public/footer'/}
        <!--获取门店列表-->
        <!-- Modal -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document" style="width: 800px;">
                <div class="modal-content">
                    <div class="modal-header" style="background: #F4F5F9;">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                        <h4 class="modal-title" id="myModalLabel">选择门店</h4>
                    </div>
                    <div class="modal-body">
                        <div class="panel panel-default panel-modal" style="border: 0;">
                            <div class="panel-heading"
                                 style="overflow: hidden;background: #F4F5F9;border: 1px solid #ddd;border-bottom: 0;">
                                <div class="checkbox pull-left">
                                    <label>
                                        <!--<input type="checkbox" id="allchoice"> 门店名称-->
                                        门店名称
                                    </label>
                                </div>
                                <div class="checkbox pull-right" style="margin-top: 10px;">
                                    <label>地址</label>
                                </div>
                            </div>
                            <div class="panel-body" style="padding: 0;">

                                <table class="table table-bordered">
                                    <tbody id="tbody"></tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer"
                         style="text-align: center;overflow: hidden;background: #F4F5F9;border: 1px solid #ddd;border-top: 0;">
                        <button type="button" class="btn btn-success" id="choiceComplate">完成</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
</body>
<script src="__STATIC_URL__/static/js/bootstrapSwitch.js"></script>
<script src="__STATIC_URL__/static/laydate/laydate.js"></script>
<script>
    function tz(obj,id,sid,tex,text){
       var val= $(obj).val();
       console.log(val);
       if(val=="wxxcx"){
           $("#"+id).attr("style","display:block");

           $("#"+tex).html("备用网页");
           $("#"+text).html("旧版微信客户端无法支持小程序，用户点击菜单时将会打开备用网页。");

       }else{
           $("#"+id).attr("style","display:none");
        
           $("#"+tex).html("链接");
           $("#"+text).html("");
       }
    }
</script>
<script>
    // var date = new Date();
    // //执行一个laydate实例
    // laydate.render({
    //     elem: '#starttime'
    //     ,type: 'datetime'
    //     ,range: true
    //     ,min:data
    // });

    var laydate = laydate;
    var date = new Date();
    var year = parseInt(date.getFullYear());
    var month = parseInt(date.getMonth())+1;
    var day = parseInt(date.getDate());
    var H = parseInt(date.getHours());
    var M =parseInt( date.getMinutes());
    var S = parseInt(date.getSeconds());
    if(month<10){
        month = "0"+month;
    }
    if(day<10){
        day = "0"+day;
    }
    var min = year+"-"+month+"-"+day +" "+ H +':'+ M +':'+S;
    console.log(min);
    var date = {
        type: 'datetime',
        min:min,
        range:'-',
        trigger: 'click'
    };
    date.elem = '#starttime';
    //执行一个laydate
    laydate.render(date);

</script>
<script>
    $('input:radio[name="supply_bonus"]').change(function(){
        if($(this).is(":checked")){
            if($(this).val()=='1'){
                $(".cardL-type").attr("style","display:flex");

            }else{
                $(".cardL-type").attr("style","display:none");

            }
        }
    });
    $("#date_info").change(function() {
        var val = $(this).val();
        $(".cover2").removeClass("show").addClass("hide");
        if(val == 'DATE_TYPE_FIX_TIME_RANGE') {

            $(".cover1").removeClass("hide").addClass("show");
            $(".cover2").removeClass("show").addClass("hide");

        } else if(val == "DATE_TYPE_FIX_TERM") {
            $(".cover1").removeClass("show").addClass("hide");
            $(".cover2").removeClass("hide").addClass("show");

        }else if(val == "DATE_TYPE_PERMANENT"){
            $(".cover1").removeClass("show").addClass("hide");
            $(".cover2").removeClass("hide").addClass("hide");
        }
    });
</script>
<script>
    var GetLength = function (str) {
        ///<summary>获得字符串实际长度，中文2，英文1</summary>
        ///<param name="str">要获得长度的字符串</param>
        var realLength = 0, len = str.length, charCode = -1;
        for (var i = 0; i < len; i++) {
            charCode = str.charCodeAt(i);
            if (charCode >= 0 && charCode <= 128) realLength += 1;
            else realLength += 2;
        }
        //console.log(realLength);
        return realLength;
    };

    //js截取字符串，中英文都能用
    //如果给定的字符串大于指定长度，截取指定长度返回，否者返回源字符串。
    //字符串，长度

    /**
     * js截取字符串，中英文都能用
     * @param str：需要截取的字符串
     * @param len: 需要截取的长度
     */
    function cutstr(str, len) {
        var str_length = 0;
        var str_len = 0;
        str_cut = new String();
        str_len = str.length;
        for (var i = 0; i < str_len; i++) {
            a = str.charAt(i);
            str_length++;
            if (escape(a).length > 4) {
                //中文字符的长度经编码之后大于4
                str_length++;
            }
            str_cut = str_cut.concat(a);
            //console.log(str_cut);
            if (str_length >= len) {
                //str_cut = str_cut.concat("...");
                return str_cut;
                // console.log(str_cut);
                //console.log(len);
            }
        }
        //如果给定字符串小于指定长度，则返回源字符串；
        if (str_length < len) {
            return str;
        }
    }
    function text(idq,tex,num){

        if (GetLength($("#"+idq).val()) > num) {

            $("#"+idq).val(cutstr($("#"+idq).val(), num));

        }else{
            $("#"+tex).text("还可以输入" + (num - $("#"+idq).val().length) + "个字");

        }
        var val=$("#"+idq).val();
        $("."+idq).html(val)
        $("."+idq).val(val)

    };
</script>
<script>


    function tex(idq,tex,num){
        console.log(idq,tex,num)
        $("#"+tex).text("还可以输入" + (num - $("#"+idq).val().length) + "个字");


        if ( $("#"+idq).val().length > num) {
            $("#"+idq).val( $("#"+idq).val().substring(0, num));
        }
        $("#"+tex).text("还可以输入" + (num -  $("#"+idq).val().length) + "个字");
        var val=$("#"+idq).val();
        $("."+idq).html(val)
        $("."+idq).val(val)
        console.log($("#"+idq).val());
    }


</script>
<script>

    function onloaded(){
        var fbt= $("#self-type-ch").find("option:selected").attr("data-fbt");
        var url = $("#self-type-ch").find("option:selected").attr("data-url");
        $("#typetext").val(fbt);
        $("#type-url").val(url);
    }
    $(function () {
        onloaded();

//        监听模态框显示调取门店数据
        $('#myModal').on('show.bs.modal', function () {
            $.ajax({
                url: "{:url('mach/getstorelist')}",
                type: "post",
                success: function (data) {
                    console.log(33,data);
                    if(data.code==0){
                        var datas = data.list.data;
                        if (datas == "") {
                            $("#tbody").html("<tr><td>暂无门店</td></tr>");
                        } else {
                            var trlist = "";
                            for (var i = 0; i < datas.length; i++) {
                                trlist += "<tr>" +
                                    "<td><div class='checkbox pull-left'><label><input type='checkbox' name='mallcheck' data-id='" + datas[i].mapid + "'>" + datas[i].business_name + "</label></div></td>" +
                                    "<td><div class='checkbox pull-left'><label>" + datas[i].address + "</label></div></td>" +
                                    "</tr>"
                            }
                            $("#tbody").html(trlist);
                        }
                    }else if(data.code==9001){
                        $("#tbody").html("<tr><td>查询失败</td></tr>");
                    }else if(data.code==9002){
                        $("#tbody").html("<tr><td>暂无门店</td></tr>");
                    }
                }
            })
        });
//        选择适用门店模态框数据清空
        $('#myModal').on('hide.bs.modal', function () {
            $("#tbody").html("");
        });
//        选择适用门店完成
        $('#choiceComplate').click(function () {
            var len = $("input[name='mallcheck']").length;
            var checkid = "";
            for (var i = 0; i < len; i++) {
                if ($("input[name='mallcheck']").eq(i).is(':checked')) {
                    var id = $("input[name='mallcheck']").eq(i).attr("data-id");
                    if (checkid == "") {
                        checkid = id;
                    } else {
                        checkid += "," + id;
                    }
                }
            }
            if (checkid == "") {
                layer.alert("请选择门店")
            } else {
                $("#location_id_list").val(checkid);
                $('#myModal').modal("hide");
            }
        });
//        全选
        $("#allchoice").click(function(){
            var t = $(this).is(":checked");
            if(t == true){
                $("input[name='mallcheck']").attr("checked",true);
            }else if(t==false){
                $("input[name='mallcheck']").removeAttr("checked");
            }
        });
        $('#end_time').datetimepicker({
            minView: "month", //选择日期后，不会再跳转去选择时分秒
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: true,
        });
    });

</script>
<script type="text/javascript">
    function upload(file, typed) {
        var formData = new FormData();
        formData.append('file', $('#' + file)[0].files[0]);
        formData.append('other', file);
        $.ajax({
            url: "{:url('uploads/upload')}",
            type: 'POST',
            cache: false,
            data: formData,
            processData: false,
            contentType: false,
        }).done(function (res) {
            if(res.code=="0"){
                //            左侧预览图背景
                $("." + file).css("backgroundImage", "url(" + res.pic + ")");
//            右侧预览图片
                $("." + file + "-img").attr("src", res.pic);
//            相应隐藏input传值
                $("#" + file + "-upload").val(res.pic);
            }else{
                layer.alert(res.message);
            }

            // $("." + file).attr("src", res.savapath).css("display", "block");
            // $(".file-" + file).val(res.other);
            // $("." + typed + "-" + file).val(res.other);
        }).fail(function (res) {
            alert("上传失败")
        });
    };
    $(function () {
//        选取优惠券背景颜色
        $(".color-list li").click(function () {
            $(".color-list li").removeClass("selected");
            $(this).addClass("selected");
            var colors = $(this).attr("data-color");
            $(".card_section").css("background-color", colors);
            $(".ljsy").css("background-color", colors);
            $("input[name='base[color]']").val(colors);
        });
    })
</script>

<script>
    $("#self-type-ch").change(function(){
        console.log($(this).val());
        var sval=$(this).val();
        if(sval=="自定义"){

            $(this).siblings("input").prop("type","text");
        }else{
            $(this).siblings("input").prop("type","hidden");
        }

    })
</script>
<script>
    function showinput(id,obj){
        var val=$(obj).val();

        $("."+id+"-bt").text(val);

    }
    function showtitl(id,obj){
        var val=$(obj).val();
        $("."+id+"-bt").text(val);
        $("."+id+"-bt").val(val);

    }
    function showhui(obj){
        var val=$(obj).val();

        $(".hui").text(val);

    }
    function showvice(obj){
        var val=$(obj).val();
        $(".vice").text(val);
    }
</script>
<script>
function shownexts2(id){
    $("#"+id+'s').addClass("active").siblings().removeClass("active");

    $("#"+id).addClass("active").siblings().removeClass("active");
}

</script>
</html>
